<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>对象的常规操作</title>
  </head>
  <body>
    <script>
      // 1.增加/修改属性
      //   var person = {
      //     name: "张三",
      //     age: 18,
      //   };
      //   console.log(person); //{name: '张三', age: 18}
      //   // 新增job属性
      //   person.job = "IT";
      //   console.log(person); //{name: '张三', age: 18, job: 'IT'}
      //   // 修改age属性值为19
      //   person.age = 19;
      //   console.log(person); //{name: '张三', age: 19, job: 'IT'}

      // 2.删除属性
      //   var person = {
      //     name: "张三",
      //     age: 18,
      //     job: "IT",
      //   };
      //   console.log(person); //{name: '张三', age: 18, job: 'IT'}
      //   // 删除job属性
      //   delete person.job;
      //   console.log(person); //{name: '张三', age: 18}

      // 3.查找对象属性
      var person = {
        name: "张三",
        age: 18,
        job: "IT",
      };
      // 查找job属性
      console.log(person.job);    //IT
      console.log(person["job"]); //IT
    </script>
  </body>
</html>
